/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-05-06 10:38:21
 * @Description: 惰性单例 例子
 */
var createLoginLayer = (function () {
  var div;
  return function () {
    if (!div) {
      div = document.createElement('div');
      div.innerHTML = '我是登录悬浮框';
      div.style.display = 'none';
      document.body.appendChild(div);
    }
    return div;
  }
})();

document.querySelector('body').onclick = function () {
  console.log(123)
  var loginLayer = createLoginLayer();
  loginLayer.style.display = 'block';
}